﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace FeatureModelTool.FileView
{
    /// <summary>
    /// Interaction logic for TextViewTab.xaml
    /// </summary>
    public partial class TextViewTab : TabItem
    {
        public TextViewTab(string text, string header)
        {
            InitializeComponent();

            this.TextContainer.Text = text;
            this.Header = header;

            MenuItem close = new MenuItem()
            {
                Header = "Close"
            };
            close.Click += new RoutedEventHandler(close_EventHandler);
            this.ContextMenu = new ContextMenu();
            this.ContextMenu.Items.Add(close);
            
        }

        /// <summary>
        /// close
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void close_EventHandler(object sender, RoutedEventArgs e)
        {
            TabControl tabControl = (TabControl)this.Parent;
            tabControl.Items.Remove(this);
        }

    }
}
